<?php
class ISOLang
{
	protected $lang_iso = 'en';
	
	public function __construct ($lang_iso)
	{
		switch ($lang_iso)
		{
			case 'fr' :
				$this->lang_iso = 'fr';
				break;
				
			case 'en' :
			default   :
				$this->lang_iso = 'en';
				break;
		}
	}
	
	public function __get($name)
	{
		switch ($name)
		{
			case 'iso' :
			case 'iso_code' :
			case 'lang_iso' :
				return $this->lang_iso;
				break;
			
			default   :
				throw new Exception ('Unknow attribute '. $name .' is not defined for the class '. __CLASS__);
		}
	}
	
	public static function getLanguage ($lang_iso)
	{
		return new self($lang_iso);
	}
	
	public static function getLanguages ()
	{
		$result = array();
		$result[] = new self('en');
		$result[] = new self('fr');
		
		return $result;
	}
}